//
//  YCPrintButton.m
//  lianganyuchu
//
//  Created by iMac on 17/3/25.
//  Copyright © 2017年 杭州桑缇电子商务有限公司. All rights reserved.
//

#import "YCPrintButton.h"

@interface YCPrintButton ()
{
    UILabel *m_labTitle;
    UILabel *m_labDesc;
    UILabel *m_labCancel;
    
}
@end
@implementation YCPrintButton

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self addSubviewsWith:frame];
    }
    return self;
}
-(void)addSubviewsWith:(CGRect)frame
{
    CGSize sizeBtn=frame.size;
    m_labTitle=[[UILabel alloc]initWithFrame:CGRectMake(kDistance, 0, 120, 50)];
    [m_labTitle setTextColor:TEXT_DEEP];
    [m_labTitle setFont:[UIFont LightFontOfSize:16]];
    [m_labTitle setTextAlignment:NSTextAlignmentCenter];
    [self addSubview:m_labTitle];
    
    m_labDesc=[[UILabel alloc]initWithFrame:CGRectMake(kDistance,37, 120, 15)];
    [m_labDesc setTextColor:BLUE_COLOR];
    [m_labDesc setText:@"正在连接中..."];
    [m_labDesc setFont:[UIFont FontOfSize:12]];
    [self addSubview:m_labDesc];

    
    m_labCancel=[[UILabel alloc]initWithFrame:CGRectMake(sizeBtn.width-80,kDistance, 65,20)];
    [m_labCancel setTextColor:MAIN_COLOR];
    [m_labCancel setText:@"取消链接"];
    [m_labCancel setFont:[UIFont FontOfSize:15]];
    [m_labCancel setTextAlignment:NSTextAlignmentRight];
    [self addSubview:m_labCancel];
    
    [m_labDesc setHidden:YES];
    [m_labCancel setHidden:YES];
}
-(void)setDataWith:(NSString *)title
{
    [m_labTitle setText:title];
}
-(void)setSelected:(BOOL)selected
{
    if (selected) {
        [m_labDesc setHidden:YES];
        [m_labCancel setHidden:NO];
        
        [m_labTitle setFrame:CGRectMake(0, kDistance, 120, 20)];
    }else{
        [m_labDesc setHidden:YES];
        [m_labCancel setHidden:YES];
        [m_labTitle setFrame:CGRectMake(0, 0, 120, 50)];
    }
}



@end
